﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using YNTK.Common.Filter;
using YNTK.Dependency;
using YNTK.System.Entitys.Dto.Common;

namespace YNTK.System.Entitys.Dto.Permission.Role
{
    /// <summary>
    /// 查询角色请求模型
    /// </summary>
    [SuppressSniffer]
    public class QueryTkRoleFilterRequestModel: PageBaseRequestModel
    {
        /// <summary>
        ///组织id
        /// </summary>
        public string organizeId { get; set; }

        /// <summary>
        /// 角色类型id
        /// </summary>
        public string dictionaryId { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用 0.禁用 2.全部
        /// </summary>
        public int? enabledMark { get; set; }

        /// <summary>
        /// 模糊查询,角色名称、角色编号、备注
        /// </summary>
        /// <example></example>
        public string keyword { get; set; }
    }

    /// <summary>
    /// 角色数据传输模型
    /// </summary>
    [SuppressSniffer]
    public class TkRoleListDto
    {
        /// <summary>
        /// 角色id
        /// </summary>
        public string id { get; set; }

        /// <summary>
        ///组织id
        /// </summary>
        public string organizeId { get; set; }

        /// <summary>
        /// 组织名称
        /// </summary>
        public string organizeName { get; set; }

        /// <summary>
        /// 是否为组织管理员角色
        /// </summary>
        public bool administrator { get; set; }

        /// <summary>
        /// 组织管理员角色标识,{组织id}#{Administrator}#{角色编号}
        /// </summary>
        public string identification { get; set; }

        /// <summary>
        /// 角色类型id
        /// </summary>
        public string dictionaryId { get; set; }

        /// <summary>
        /// 角色类型文本
        /// </summary>
        public string dictionaryText { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 角色编号
        /// </summary>
        public string code { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }
    }

    /// <summary>
    /// 添加角色请求模型
    /// </summary>
    [SuppressSniffer]
    public class AddTkRoleRequestModel
    {
        /// <summary>
        ///组织id,运营平台创建平台角色传00000000
        /// </summary>
        [Required(ErrorMessage = "组织标识不能为空")]
        public string organizeId { get; set; }

        /// <summary>
        /// 角色类型id
        /// </summary>
        public string dictionaryId { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        [Required(ErrorMessage = "角色名称不能为空")]
        public string name { get; set; }

        /// <summary>
        /// 角色编号
        /// </summary>
        [Required(ErrorMessage = "角色编号不能为空")]
        public string code { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string description { get; set; }

        /// <summary>
        /// 排序码
        /// </summary>
        public long? sortCode { get; set; }

        /// <summary>
        /// 启用/禁用,1.启用
        /// </summary>
        public int? enabledMark { get; set; }
    }

    /// <summary>
    /// 修改角色请求模型
    /// </summary>
    [SuppressSniffer]
    public class UpdateTkRoleRequestModel: AddTkRoleRequestModel
    {
        /// <summary>
        /// id
        /// </summary>
        [Required(ErrorMessage = "角色唯一标识不能为空")]
        public string id { get; set; }
    }

    /// <summary>
    /// 角色菜单权限数据传输模型
    /// </summary>
    [SuppressSniffer]
    public class RoleMenuPermissionsListDto
    {
        /// <summary>
        /// 菜单id
        /// </summary>
        public string menuId { get; set; }

        /// <summary>
        /// 按钮权限,多个按逗号分割
        /// </summary>
        public string authoritys { get; set; }

        /// <summary>
        /// 按钮权限文本
        /// </summary>
        public string authoritysText { get; set; }

        /// <summary>
        /// 按钮集合
        /// </summary>
        public List<EnumListDto> authoritysData { get; set; }
    }

    /// <summary>
    /// 设置角色菜单权限请求模型
    /// </summary>
    [SuppressSniffer]
    public class SetRoleMenuPermissionsRequestModel
    {
        /// <summary>
        /// 角色id
        /// </summary>
        [Required(ErrorMessage = "角色唯一标识不能为空")]
        public string id { get; set; }

        /// <summary>
        /// 菜单权限
        /// </summary>
        [Required(ErrorMessage = "请至少选择一个菜单")]
        public List<MenuPermissionsRequestModel> menuData { get; set; }
    }

    /// <summary>
    /// 菜单权限
    /// </summary>
    [SuppressSniffer]
    public class MenuPermissionsRequestModel
    {
        /// <summary>
        /// 菜单id
        /// </summary>
        [Required(ErrorMessage = "菜单唯一标识不能为空")]
        public string menuId { get; set; }

        /// <summary>
        /// 按钮权限,多个按逗号分割
        /// </summary>
        public string authoritys { get; set; }
    }

}
